﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using TileEngine.tiles;

namespace TileEngine.liquids
{
    class Water:Iliquid
    {
        int spriteFrame = 0;
        float particle = 10;
        public double getLightAbsorption()
        {
            return 0.9;
        }
        public float getParticle()
        {
            return particle;
        }
        public void setParticle(float n)
        {
            this.particle = n;
        }
        public void addParticle(float n)
        {
            this.particle += n;
        }

        public void draw(SpriteBatch spriteBatch, Rectangle destinationRectangle,Color tint)
        {
            //spriteBatch.Draw(Textures.liquid[spriteFrame/20], destinationRectangle,new Color(240,240,240,180));
            if (particle >= 10)
                spriteBatch.Draw(Textures.liquid[spriteFrame / 20], new Rectangle(destinationRectangle.X, destinationRectangle.Y, 20, 20), new Color(tint.R, tint.G, tint.B, 190));
            else
                spriteBatch.Draw(Textures.liquid[spriteFrame / 20], new Rectangle(destinationRectangle.X, destinationRectangle.Y + 20 - (int)particle * 2, 20, (int)particle * 2), new Color(tint.R, tint.G, tint.B, 190));   


            //spriteBatch.DrawString(Textures.font1,(particle).ToString("R"), new Vector2(destinationRectangle.Location.X, destinationRectangle.Location.Y), Color.Black);
            spriteFrame = (spriteFrame + 2) % 60;
        }

    }
}
